<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    <h1>一级页面</h1>
    <iframe id="iframe" src="http://127.0.0.1:8080" frameborder="0" width="500px" height="500px"></iframe>
    <script>
        document.domain='127.0.0.1'
        var data='我是一级页面'
        document.getElementById('iframe').onload=function(){
            console.log(this.contentWindow.data=data);
            

        }


    </script>

</body>
</html>